package ups.Schedule;
import org.htmlparser.Parser;

import java.util.ArrayList;

public class ScheduleBuilder {
	public ArrayList<ScheduleItem> schedule = new ArrayList<ScheduleItem>();
	
	public ScheduleBuilder( String[] scheduleURLs ) {
		try {
			for( String url : scheduleURLs ) {
				System.out.println( url );
				ScheduleVisitor sv = new ScheduleVisitor();
				Parser p = new Parser( url );
				p.visitAllNodesWith( sv );
				schedule.addAll( sv.scheduleItems() );
			}
		} catch( Exception e ) {
				e.printStackTrace();
		}
	}
	
	public ArrayList<ScheduleItem> getSchedule() {
		return schedule;
	}
}
